<?php
require_once("../conexion/conexion.php");

$CodExp = $_GET['CodExp'];
$CodOfe = $_GET['CodOfe'];
$POfe = $_GET['POfe'];

$query = "SELECT * FROM PERSONA_SELECCIONADA WHERE OFE_CODIGO='$CodOfe'";
$Cant = mysql_query($query);
$rows = mysql_num_rows($Cant);
if ($rows<$POfe) 
{
		$query = "CALL SP_INSERT_CAND_OFERTA ('$CodExp', '$CodOfe')";
		$result = mysql_query($query);
		if (!$result) 
				{
					die ("Invalido: " . mysql_error());
			}
		else
		{
			echo "1";
		}
}
else
{
	echo "2";
}
?>
